'use strict';

/**
 * cookies
 *
 * cache要在app进行申明依赖
 */
angular.module('app').service('cache',['$cookies', function ($cookies) {
    this.put = function (key,value) {
        $cookies.put(key,value);
    };
    this.get = function (key) {
        return $cookies.get(key);
    };
    this.remove = function (key) {
        $cookies.remove(key);
    };
}]);
    // 等同于以上功能 factory比service功能强大一点
    // .factory('cache',['$cookies',function ($cookies) {
    //     return {
    //         put : function (key,value) {
    //             $cookies.put(key,value);
    //         },
    //         get : function (key) {
    //             return $cookies.get(key);
    //         },
    //         remove : function (key) {
    //             $cookies.remove(key);
    //         }
    //     }
    // }]);












